﻿@model Product

@{
    string url = Model.Category.SizeChart;

    string ext = url.Split('.').Last();

    List<string> extImage = new List<string> { "jpg", "png", "jpeg" };
}

<div class="form-group">
    <a class="cus-link no-href" data-toggle="modal" data-target="#sizeChartModal">
        <i class="fa fa-question-circle"></i> Mô tả size
    </a>

    <div class="modal modal-primary fade" id="sizeChartModal" tabindex="-1" role="dialog" aria-labelledby="sizeChartModalLabel" aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                    <h4 class="modal-title" id="sizeChartModalLabel">Mô tả size</h4>
                </div>
                <div class="modal-body">
                    @if (extImage.Contains(ext))
                    {
                        <img src="@url" class="img-responsive" style="width: 100%;" />
                    }
                    else
                    {
                        <div class="jumbotron text-center">
                            <p>
                                Tập tin có định dạng .@ext
                            </p>
                            <p>
                                <a href="@url" class="btn btn-primary btn-lg" role="button" target="_blank">
                                    <i class="fa fa-download"></i> Tải về
                                </a>
                            </p>
                        </div>
                    }
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Đóng</button>
                </div>
            </div>
        </div>
    </div>
</div>